home *** CD-ROM | disk | FTP | other *** search
/ Aminet 50 / Aminet 50 (2002)(GTI - Schatztruhe)[!][Aug 2002].iso / Aminet / text / edit / tecoc-146.lha / format.tes < prev    next >
Text File  |  1991-07-11  |  2KB  |  70 lines

  1. ei
  2. 
  3.     Formatting the first part of each line...
  4. 
  5.  
  6. ! put the code to handle the first six spaces of the line into !
  7. ! q-register A. !
  8.  
  9. [a                                  ! save q-register a !
  10. @^ua/
  11. 0a-9"e/27:^ua:^ua@:^ua/'        ! if first char is a tab, return !
  12. 0ua5<0a-9"e1;'c%a>                  ! count number of non-tab characters !
  13. qa-5"e                              ! if there's 5 non-tab characters !
  14.     0a-9"n                          ! if sixth char is not a tab !
  15.         0a-32"n                     ! and it's not a space !
  16.              di+                   ! make the continuation mark be + !
  17.              0a-32"e                ! if next char is space !
  18.                    d9i             ! make it a tab !
  19.                    |
  20.                    0a-9"n           ! if char after mark is not a tab !
  21.                        9i          ! insert a tab !
  22.                        '
  23.                    '
  24.              /27:^ua:^ua@:^ua/  ! return !
  25.              '
  26.         '
  27.     '
  28.  
  29. ! if we made it to here, then it's not a continuation line, it doesn't start
  30. with a tab,  and the number of chars in the label field is in q-register A !
  31.  
  32. ! terminate the label field with a tab !
  33.  
  34. 0a-9"n               ! if it's not already a tab !
  35.     0a-32"ed'        ! if it's a space, delete it !
  36.     9i              ! insert a tab !
  37.     '
  38. qbj5<0a-32"n1;'d>          ! remove leading spaces !
  39. qbjs    <r0a-32"n1;'d>       ! remove trailing spaces !
  40. /
  41. 27:^ua
  42. 27:^ua
  43. ! Q-register A is loaded,  do the main loop !
  44.  
  45.  
  46.  
  47. j
  48. <                                   ! for each line !
  49. 0a-^^D"ec'                          ! if it starts with D, skip it !
  50. 0a-^^d"ec'                          ! if it starts with d, skip it !
  51. .ub                                 ! save pointer to start of line !
  52. 0a-13"n                             ! if it's not a blank line !
  53.      0a-^^C"n                       ! and it doesn't start with C !
  54.            0a-^^c"n                 ! and it doesn't start with c !
  55.                  0a-^^*"n           ! and it doesn't start with * !
  56.                        0a-^^!"n     ! and it doesn't start with excl. mark !
  57.                              ma     ! handle the first part !
  58.                              '
  59.                        '
  60.                  '
  61.            '
  62.      '
  63. s
  64.                     ! move to the next line !
  65. .-z"e1;'                      ! if at end-of-buffer, leave the loop !
  66. >
  67. ]a                            ! restore q-register a !
  68. 
  69. 
  70.